<%@ page language="java" %>

<%@ page import="java.util.*,
                 java.net.*,
                 java.lang.*,
                 com.broadvision.web.util.ViewDynaBean,
		 org.apache.struts.validator.DynaValidatorForm,
                 org.apache.commons.beanutils.PropertyUtils"
%>

<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %> 


<% String ctxPath = request.getContextPath(); %>

<jsp:useBean id="cmProcessMapListView" scope="request" type="com.broadvision.web.util.ViewDynaBean"/> 
<bean:size id="resultSize" name="cmProcessMapListView" property="processMapList"/>

<script language="javascript">

function doProcessMapEditAction(theForm, documentType, documentTypeFName, actionName, actionFName, processPack, processName) {
  theForm.documentType.value = documentType;
  theForm.documentTypeFName.value = documentTypeFName;
  theForm.actionName.value = actionName;
  theForm.actionFName.value = actionFName;
  theForm.processPack.value = processPack;
  theForm.processName.value = processName;
  theForm.action = '<html:rewrite page="/cm/processMapEdit.do"/>' + "?cpAction=edit";
  theForm.submit();
  return true;
}

function doProcessMapDeleteAction(theForm, documentType, actionName, processPack, processName) {
  if (confirmDelete() == false)
    return false;
  theForm.documentType.value = documentType;
  theForm.actionName.value = actionName;
  theForm.processPack.value = processPack;
  theForm.processName.value = processName;
  theForm.action = '<html:rewrite page="/cm/processMapDelete.do"/>';
  theForm.submit();
  return true;
}
  
function confirmDelete() {
  return confirm("<bean:message bundle='cm.messages' key='cm.content.processMap.confirm.delete'/>")
}

function doProcessMapNewAction(theForm) {
      theForm.action = '<html:rewrite page="/cm/processMapCreate.do"/>';
      theForm.submit();
      return true;
}

</script>

<table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle='cm.messages' key='cm.content.processMap.list'/>">
  <tr> 
  <td valign="top" width="100%">
  
  <div class="pageTitle"><bean:message bundle='cm.messages' key='cm.content.processMap.list'/></div>

  <%@include file="/mc/common/pagetab.jsp" %>

  <html:form action="/cm/processMapSearch.do?action=search">
  <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0" summary="<bean:message bundle='cm.messages' key='cm.content.processMap.list'/>">         
    <tr>
      <td width="15%" nowrap>
         <b><bean:message bundle='cm.messages' key='cm.content.processMap.documentType'/>:</b>
      </td>
      <td width="30%" nowrap>
        <html:text property="cpDocumentType" size="31" maxlength="80"/>
      </td>
      <td width="55%" nowrap>
         <input hspace="40" type="submit" name="btn_action" class="inputButton" value="<bean:message bundle='cm.messages' key='button.goto'/>">
      </td>
    </tr>  
  </table>
  </html:form>
  
  <logic:match name="cmProcessMapListView" property="searchResultMsg" value="ShowResults">
  <div class="pageSubtitle">
     <span class="left"><bean:message bundle='cm.messages' key='cm.content.processMap.list'/></span>
     <span class="right">
            <html:button styleClass="titleButton" property="submitBtn" onclick="return doProcessMapNewAction(document.cmContentProcessMapEditForm);">
              <bean:message bundle='cm.messages' key="button.newProcessMapping"/>
            </html:button>
     </span>

  </div> 
  
  <html:form action="/cm/processMapEdit.do">
  <input type="hidden" name="documentType"/>
  <input type="hidden" name="documentTypeFName"/>
  <input type="hidden" name="actionName"/>
  <input type="hidden" name="actionFName"/>
  <input type="hidden" name="processPack"/>
  <input type="hidden" name="processName"/>
  
  <table class="dataTable" border="0" cellspacing="1" cellpadding="2" width="100%" summary="<bean:message bundle='cm.messages' key='cm.content.processMap.list'/>">
  <tr class="listHeader">
    <th id="Document Type" align="left"><bean:message bundle='cm.messages' key='cm.content.processMap.documentType'/></th>
    <th id="Action Name" align="left"><bean:message bundle='cm.messages' key='cm.content.processMap.actionName'/></th>
    <th id="Process Pack" align="left"><bean:message bundle='cm.messages' key='cm.content.processMap.processPack'/></th>
    <th id="Process Name" align="left"><bean:message bundle='cm.messages' key='cm.content.processMap.processName'/></th>
    <th id="Actions" align="left" nowrap><bean:message bundle='cm.messages' key='cm.content.processMap.actions'/></th>
  </tr>     
  
  <logic:equal name="resultSize" value="0">
  <tr class="listEven"> 
    <td colspan="5" valign="top" align="center"><bean:message bundle='cm.messages' key='cm.content.processMap.noProcessMapFound'/></td>
  </tr>
  </logic:equal>

  <logic:iterate id="processMap" name="cmProcessMapListView" property="processMapList" indexId="index">  
    <tr class='<%=index.intValue() %2 == 0 ? "listEven" : "listOdd"%>'>
      <td headers="Document Type"><bean:write name="processMap" property="documentTypeFName"/></td>
      <td headers="Action Name"><bean:write name="processMap" property="actionFName"/></td>
      <td headers="Process Pack"><bean:write name="processMap" property="processPack"/></td>
      <td headers="Process Name"><bean:write name="processMap" property="processName"/></td>
      <td nowrap headers="Actions" align="left">
        <a href="#" onclick='javascript:doProcessMapEditAction(document.cmContentProcessMapEditForm, "<bean:write name="processMap" property="documentType"/>", "<bean:write name="processMap" property="documentTypeFName"/>", "<bean:write name="processMap" property="actionName"/>", "<bean:write name="processMap" property="actionFName"/>", "<bean:write name="processMap" property="processPack"/>", "<bean:write name="processMap" property="processName"/>")'>
        <img src="<%=ctxPath%>/mc/images/action/icon_edit.gif" width="15" height="15" border="0" class="actionIcon" alt='<bean:message bundle='cm.messages' key='image.alt.editProcessMap'/>' title='<bean:message bundle='cm.messages' key='image.alt.editProcessMap'/>' /></a>
        
        <a href="#" onclick='javascript:doProcessMapDeleteAction(document.cmContentProcessMapEditForm, "<bean:write name="processMap" property="documentType"/>", "<bean:write name="processMap" property="actionName"/>", "<bean:write name="processMap" property="processPack"/>", "<bean:write name="processMap" property="processName"/>")'>
        <img src="<%=ctxPath%>/mc/images/action/icon_delete.gif" width="15" height="15" border="0" class="actionIcon" alt='<bean:message bundle='cm.messages' key='image.alt.deleteProcessMap'/>' title='<bean:message bundle='cm.messages' key='image.alt.deleteProcessMap'/>' /></a>
      </td>
    </tr>
  </logic:iterate>
  
  </table>
  </html:form>
  </logic:match>
  
  </td>
  </tr>
</table>
